from django.db import models
from artSightWorld.apps.map.models import *
from django.contrib.auth.models import User

class Photographer(models.Model):
	dateOfBirth = models.DateField(blank=True, null=True)
	description = models.TextField(blank=True)
	photoProfile = models.ImageField(upload_to='media/uploads/avatar', blank=True, null=True)
	banned = models.BooleanField()
	website = models.URLField(blank=True)
	telNumber = models.CharField(max_length=15, blank=True)
	status = models.ForeignKey('Status')
	city = models.TextField(blank=True)
	photographersLiked = models.ManyToManyField("self", symmetrical=False)
	photosLiked = models.ManyToManyField('Photo', related_name='photosLiked')
	user = models.ForeignKey(User)
	
	def __unicode__(self):
		return "%s" % (self.user.username)

class Photo(models.Model):
	image = models.ImageField(upload_to='uploads/original/')
	height = models.IntegerField()
	width = models.IntegerField()
	latitude = models.FloatField()
	longitude = models.FloatField()
	dateTaken = models.DateField()
	datePosted = models.DateTimeField(auto_now=True)
	caption = models.TextField(blank=True)
	title = models.CharField(max_length=255, blank=True)
	banned = models.BooleanField()
	city = models.ForeignKey(City)
	album = models.ForeignKey('Album')
	tagTheme = models.ManyToManyField('TagTheme')
	tagColor = models.ManyToManyField('TagColor')

	def __unicode__(self):
		return "%s" % (self.title)

class Album(models.Model):
	nom = models.CharField(max_length=45)
	photographer = models.ForeignKey(User)
	
	def __unicode__(self):
		return "%s" % (self.nom)

class TagTheme(models.Model):
	nom = models.CharField(max_length=45)

class TagColor(models.Model):
	nom = models.CharField(max_length=45)
	
class Status(models.Model):
	name = models.CharField(max_length=45)
